/*
 * PanelEditor.java
 *
 * Created on Aug 18, 2009, 8:27:41 PM
 *
 * Copyright (C) 2007-2008  Hylke van der Schaaf
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package hextd.UI;

import hextd.HexTD;
import hextd.core.ContextNormal;
import hextd.hex.Hex;
import hextd.hex.Hex.HexType;
import javax.swing.DefaultComboBoxModel;

public class PanelEditor extends javax.swing.JPanel {

	private ContextNormal context;
	private boolean inited = false;
	private boolean loading = false;

	/** Creates new form PanelEditor */
	public void setContext(ContextNormal c) {
		context = c;
	}

	private void doInit() {
		inited = true;
		initComponents();
		jComboBoxHextype.setModel(new DefaultComboBoxModel(Hex.HexType.values()));
		panelPathEditor.setContext(context);
		panelEditorTowers1.setContext(context);
	}

	public void mapChanged() {
		if (isVisible()) {
			ContextNormal ct = context;
			
			jSpinner_interestStart.setValue(ct.loadedGameMap.interestStart);
			jSpinner_interestIncrease.setValue(ct.loadedGameMap.interestIncrease);
			jSpinner_moneyStart.setValue(ct.loadedGameMap.budget);
			jSpinner_lives.setValue(ct.loadedGameMap.lives);
			jTextField_background.setText(ct.loadedGameMap.backGroundImage);
			jTextField_title.setText(ct.loadedGameMap.title);
			jTextAreaInfo.setText(ct.loadedGameMap.info);
			jTextAreaStory.setText(ct.loadedGameMap.story);
			jTextAreaStoryWin.setText(ct.loadedGameMap.storyWin);
			jTextAreaStoryLos.setText(ct.loadedGameMap.storyLos);

			if (context.getGameGrid() != null) {
				jSpinner_height.setValue(new Integer(context.getGameGrid().getGridHeight()));
				jSpinner_width.setValue(new Integer(context.getGameGrid().getGridWidth()));
			}
			panelPathEditor.resetPaths();
		}
	}

	private void resizeGrid() {
		if (!loading) {
			if (this.context.getGameState() == HexTD.GameState.editing) {
				context.getGameGrid().resizeGrid(
						new Integer(jSpinner_width.getValue().toString()).intValue(),
						new Integer(jSpinner_height.getValue().toString()).intValue(),
						jCheckBox_addTop.isSelected(),
						jCheckBox_addLeft.isSelected());
				context.getGameBoard().recalculateScale();
			}
		}
	}

	public void hexClicked(Hex hex) {
		if (isVisible()) {
			if (panelPathEditor.isVisible()) {
				panelPathEditor.hexClicked(hex);
			} else if (panelEditorTowers1.isVisible()) {
				panelEditorTowers1.hexClicked(hex);
			} else {
				Hex.HexType to = (HexType) jComboBoxHextype.getSelectedItem();
				context.getGameGrid().changeHex(hex, to);
				context.getGameBoard().hexChanged();
			}
		}
	}

	@Override
	public void setVisible(boolean aFlag) {
		loading = true;
		if (aFlag && !inited) {
			doInit();
		}
		super.setVisible(aFlag);
		mapChanged();
		loading = false;
	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jFrame1 = new javax.swing.JFrame();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextPane_output = new javax.swing.JTextPane();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanelEditor = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jSpinner_width = new javax.swing.JSpinner();
        jSpinner_height = new javax.swing.JSpinner();
        jLabel4 = new javax.swing.JLabel();
        jCheckBox_addTop = new javax.swing.JCheckBox();
        jCheckBox_addLeft = new javax.swing.JCheckBox();
        jButton_printMap = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaInfo = new javax.swing.JTextArea();
        jPanelHex = new javax.swing.JPanel();
        jComboBoxHextype = new javax.swing.JComboBox();
        jPanelSettings = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jTextField_background = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jSpinner_moneyStart = new javax.swing.JSpinner();
        jSpinner_interestStart = new javax.swing.JSpinner();
        jSpinner_interestIncrease = new javax.swing.JSpinner();
        jSpinner_lives = new javax.swing.JSpinner();
        jLabel18 = new javax.swing.JLabel();
        jTextField_title = new javax.swing.JTextField();
        panelPathEditor = new hextd.UI.PanelEditorPaths();
        panelEditorTowers1 = new hextd.UI.PanelEditorTowers();
        jPanelStory = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextAreaStory = new javax.swing.JTextArea();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextAreaStoryWin = new javax.swing.JTextArea();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTextAreaStoryLos = new javax.swing.JTextArea();

        jFrame1.getContentPane().setLayout(new java.awt.GridBagLayout());

        jScrollPane2.setMinimumSize(new java.awt.Dimension(200, 200));
        jScrollPane2.setPreferredSize(new java.awt.Dimension(200, 200));
        jScrollPane2.setViewportView(jTextPane_output);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 0.01;
        gridBagConstraints.weighty = 0.01;
        jFrame1.getContentPane().add(jScrollPane2, gridBagConstraints);

        setLayout(new java.awt.BorderLayout());

        jPanelEditor.setFocusable(false);
        jPanelEditor.setLayout(new java.awt.GridBagLayout());

        jLabel2.setText("Width:");
        jLabel2.setFocusable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jLabel2, gridBagConstraints);

        jSpinner_width.setModel(new javax.swing.SpinnerNumberModel(12, 2, 99, 1));
        jSpinner_width.setFocusable(false);
        jSpinner_width.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_widthStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.01;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jSpinner_width, gridBagConstraints);

        jSpinner_height.setModel(new javax.swing.SpinnerNumberModel(12, 2, 99, 1));
        jSpinner_height.setFocusable(false);
        jSpinner_height.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_heightStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.weightx = 0.01;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jSpinner_height, gridBagConstraints);

        jLabel4.setText("Height:");
        jLabel4.setFocusable(false);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jLabel4, gridBagConstraints);

        jCheckBox_addTop.setText("top");
        jCheckBox_addTop.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jCheckBox_addTop, gridBagConstraints);

        jCheckBox_addLeft.setText("left");
        jCheckBox_addLeft.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jCheckBox_addLeft, gridBagConstraints);

        jButton_printMap.setText("print");
        jButton_printMap.setMargin(new java.awt.Insets(2, 2, 2, 2));
        jButton_printMap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_printMapActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelEditor.add(jButton_printMap, gridBagConstraints);

        jScrollPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Map Info"));

        jTextAreaInfo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextAreaInfoKeyTyped(evt);
            }
        });
        jScrollPane1.setViewportView(jTextAreaInfo);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 8;
        gridBagConstraints.gridwidth = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0E-7;
        gridBagConstraints.weighty = 0.05;
        jPanelEditor.add(jScrollPane1, gridBagConstraints);

        jPanelHex.setBorder(javax.swing.BorderFactory.createTitledBorder("Create hex type:"));
        jPanelHex.setLayout(new java.awt.BorderLayout());

        jComboBoxHextype.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jPanelHex.add(jComboBoxHextype, java.awt.BorderLayout.CENTER);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.01;
        jPanelEditor.add(jPanelHex, gridBagConstraints);

        jPanelSettings.setBorder(javax.swing.BorderFactory.createTitledBorder("Settings"));
        jPanelSettings.setLayout(new java.awt.GridBagLayout());

        jLabel15.setText("Start Money:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jLabel15, gridBagConstraints);

        jTextField_background.setText("jTextField1");
        jTextField_background.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_backgroundActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jTextField_background, gridBagConstraints);

        jLabel17.setText("background:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jLabel17, gridBagConstraints);

        jLabel16.setText("Start Lives:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jLabel16, gridBagConstraints);

        jLabel14.setText("Interest Increase:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jLabel14, gridBagConstraints);

        jLabel13.setText("Start Interest:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jLabel13, gridBagConstraints);

        jSpinner_moneyStart.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_moneyStartStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jSpinner_moneyStart, gridBagConstraints);

        jSpinner_interestStart.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_interestStartStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jSpinner_interestStart, gridBagConstraints);

        jSpinner_interestIncrease.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_interestIncreaseStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jSpinner_interestIncrease, gridBagConstraints);

        jSpinner_lives.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSpinner_livesStateChanged(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
        jPanelSettings.add(jSpinner_lives, gridBagConstraints);

        jLabel18.setText("Title:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 2, 2);
        jPanelSettings.add(jLabel18, gridBagConstraints);

        jTextField_title.setText("jTextField1");
        jTextField_title.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField_titleActionPerformed(evt);
            }
        });
        jTextField_title.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextField_titleKeyTyped(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.0010;
        gridBagConstraints.insets = new java.awt.Insets(0, 2, 2, 2);
        jPanelSettings.add(jTextField_title, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 0.01;
        jPanelEditor.add(jPanelSettings, gridBagConstraints);

        jTabbedPane1.addTab("Grid", jPanelEditor);

        panelPathEditor.setMinimumSize(null);
        jTabbedPane1.addTab("Paths", panelPathEditor);
        jTabbedPane1.addTab("Towers", panelEditorTowers1);

        jPanelStory.setLayout(new javax.swing.BoxLayout(jPanelStory, javax.swing.BoxLayout.Y_AXIS));

        jScrollPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Map Story"));

        jTextAreaStory.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextAreaStoryKeyTyped(evt);
            }
        });
        jScrollPane3.setViewportView(jTextAreaStory);

        jPanelStory.add(jScrollPane3);

        jScrollPane4.setBorder(javax.swing.BorderFactory.createTitledBorder("Map Story Victory"));

        jTextAreaStoryWin.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextAreaStoryWinKeyTyped(evt);
            }
        });
        jScrollPane4.setViewportView(jTextAreaStoryWin);

        jPanelStory.add(jScrollPane4);

        jScrollPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Map Story Defeat"));

        jTextAreaStoryLos.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTextAreaStoryLosKeyTyped(evt);
            }
        });
        jScrollPane5.setViewportView(jTextAreaStoryLos);

        jPanelStory.add(jScrollPane5);

        jTabbedPane1.addTab("Story", jPanelStory);

        add(jTabbedPane1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

	private void jSpinner_widthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_widthStateChanged
		resizeGrid();
}//GEN-LAST:event_jSpinner_widthStateChanged

	private void jSpinner_heightStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_heightStateChanged
		resizeGrid();
}//GEN-LAST:event_jSpinner_heightStateChanged

	private void jButton_printMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_printMapActionPerformed
		jTextPane_output.setText(this.context.getMapInfo().getContent());
		jFrame1.setVisible(true);
		jFrame1.pack();
}//GEN-LAST:event_jButton_printMapActionPerformed

	private void jSpinner_interestStartStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_interestStartStateChanged
		try {
			context.loadedGameMap.interestStart = Integer.parseInt(jSpinner_interestStart.getValue().toString());
		} catch (NumberFormatException ex) {
			ex.printStackTrace();
		}
}//GEN-LAST:event_jSpinner_interestStartStateChanged

	private void jSpinner_interestIncreaseStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_interestIncreaseStateChanged
		try {
			context.loadedGameMap.interestIncrease = Integer.parseInt(jSpinner_interestIncrease.getValue().toString());
		} catch (NumberFormatException ex) {
			ex.printStackTrace();
		}
}//GEN-LAST:event_jSpinner_interestIncreaseStateChanged

	private void jSpinner_moneyStartStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_moneyStartStateChanged
		try {
			context.loadedGameMap.budget = Integer.parseInt(jSpinner_moneyStart.getValue().toString());
		} catch (NumberFormatException ex) {
			ex.printStackTrace();
		}
}//GEN-LAST:event_jSpinner_moneyStartStateChanged

	private void jSpinner_livesStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSpinner_livesStateChanged
		try {
			context.loadedGameMap.lives = Integer.parseInt(jSpinner_lives.getValue().toString());
		} catch (NumberFormatException ex) {
			ex.printStackTrace();
		}
}//GEN-LAST:event_jSpinner_livesStateChanged

	private void jTextField_backgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_backgroundActionPerformed
		context.loadedGameMap.backGroundImage = jTextField_background.getText();
}//GEN-LAST:event_jTextField_backgroundActionPerformed

	private void jTextField_titleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField_titleActionPerformed
		context.loadedGameMap.title = jTextField_title.getText();
}//GEN-LAST:event_jTextField_titleActionPerformed

	private void jTextField_titleKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_titleKeyTyped
		context.loadedGameMap.title = jTextField_title.getText();
}//GEN-LAST:event_jTextField_titleKeyTyped

	private void jTextAreaInfoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextAreaInfoKeyTyped
		context.loadedGameMap.info = jTextAreaInfo.getText();
	}//GEN-LAST:event_jTextAreaInfoKeyTyped

	private void jTextAreaStoryKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextAreaStoryKeyTyped
		context.loadedGameMap.story = jTextAreaStory.getText();
	}//GEN-LAST:event_jTextAreaStoryKeyTyped

	private void jTextAreaStoryWinKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextAreaStoryWinKeyTyped
		context.loadedGameMap.storyWin = jTextAreaStoryWin.getText();
	}//GEN-LAST:event_jTextAreaStoryWinKeyTyped

	private void jTextAreaStoryLosKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextAreaStoryLosKeyTyped
		context.loadedGameMap.storyLos = jTextAreaStoryLos.getText();
	}//GEN-LAST:event_jTextAreaStoryLosKeyTyped

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton_printMap;
    private javax.swing.JCheckBox jCheckBox_addLeft;
    private javax.swing.JCheckBox jCheckBox_addTop;
    private javax.swing.JComboBox jComboBoxHextype;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanelEditor;
    private javax.swing.JPanel jPanelHex;
    private javax.swing.JPanel jPanelSettings;
    private javax.swing.JPanel jPanelStory;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSpinner jSpinner_height;
    private javax.swing.JSpinner jSpinner_interestIncrease;
    private javax.swing.JSpinner jSpinner_interestStart;
    private javax.swing.JSpinner jSpinner_lives;
    private javax.swing.JSpinner jSpinner_moneyStart;
    private javax.swing.JSpinner jSpinner_width;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextArea jTextAreaInfo;
    private javax.swing.JTextArea jTextAreaStory;
    private javax.swing.JTextArea jTextAreaStoryLos;
    private javax.swing.JTextArea jTextAreaStoryWin;
    private javax.swing.JTextField jTextField_background;
    private javax.swing.JTextField jTextField_title;
    private javax.swing.JTextPane jTextPane_output;
    private hextd.UI.PanelEditorTowers panelEditorTowers1;
    private hextd.UI.PanelEditorPaths panelPathEditor;
    // End of variables declaration//GEN-END:variables
}
